/*
 * Author: http://www.redwolf-soft.com
 * All Rights Reserved
 * 
 * 2013.11
 *   
 * */
package com.redwolfsoft.libshoppingserver.brand;

import net.sf.json.JSONObject;



public class BrandShopInfo {
	
	public final static String TAG = "BrandShopInfo";
	
	public String id = null;
	public String mallName = null;//商场名称
	public String name = null;	//次级名称，如复兴门店，已与商场名称合到一块
	public String location = null;//位置信息,商场中的位置描述
	
	//以下为专卖店详细信息
	public String address = null;
	public String phoneNumer = null;
	public String mapUrlStr = null;
	
	public double longitude = 0.0;
	public double latitude = 0.0;
	
	public BrandShopInfo(String id, String mall, String name ,String location,
			String address,String phone,String mapUrl,double longitude,double latitude)
	{
		this.id = id;
		this.mallName = mall;
		this.name=name;
		this.location=location;
		
		this.phoneNumer=phone;
		this.address=address;
		this.mapUrlStr=mapUrl;
		
		this.longitude = longitude;
		this.latitude = latitude;
	}
	
	public BrandShopInfo(JSONObject obj)
	{
		if(obj==null)
		{
			//Log.w(TAG, "JSONObject is null");
			return;
		}
		//try {		
			id = obj.getString("id");
			mallName = obj.getString("mallName");
			name = obj.getString("name");
			location = obj.getString("location");
			
			address = obj.getString("address");
			phoneNumer = obj.getString("phoneNumer");
			mapUrlStr = obj.getString("mapUrlStr");			
			longitude = obj.optDouble("longitude");
			latitude = obj.optDouble("latitude");
		/*} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}*/
	}
	
	public JSONObject toJsonObject()
	{
		JSONObject obj = new JSONObject();
		//JSONObject obj2 = new JSONObject();
		//try {
			obj.put("id", id);
			obj.put("mallName", mallName);
			obj.put("name", name);
			obj.put("location", location);
			obj.put("address", address);
			obj.put("phoneNumer", phoneNumer);
			obj.put("mapUrlStr", mapUrlStr);
			obj.put("longitude", longitude);
			obj.put("latitude", latitude);
			//obj2.put(TAG, obj);
		/*} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}*/
		return obj;
		
	}
	
}
